package Thread;


//2. 实现Runable
class MyThread2 implements Runnable{
    static int count = 0;

    @Override
    public void run() {
        while (true){
            System.out.println(count++);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
public class Test02{


    public static void main(String[] args) throws InterruptedException {
        MyThread2 myThread2 = new MyThread2();
        Thread t = new Thread(myThread2);
        t.start();
        while (true){
            System.out.println("我是main线程");
            Thread.sleep(1000);
        }

    }
}
